"""
Train our Naive Bayes algorithm and get the validation.

"""

import numpy as np
from model import NaiveBayes

# Get training data and validation data.
train_data = np.load('Dataset/data/train.npy')
val_data = np.load('Dataset/data/val.npy')

# train our naive bayes model
model = NaiveBayes.NB(labels=[0,1,2,3]) # [0, 1, 2, 3] < -- > ['gufeng', 'liuxing', 'minyao', 'shuochang']
model.train(train_data)

# validation and compute the accuracy
pred_y, true_y = model.test(val_data)
print('The precision of our model is:', (pred_y == true_y) / len(pred_y))